package edu.npu.cv.vo;

import edu.npu.cv.entity.MemberDO;
import lombok.Data;
import org.w3c.dom.stylesheets.LinkStyle;

import java.lang.reflect.Member;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName MemberVO
 * @Description TODO
 * @Author Quentin_zyj
 * @Date 2021/10/15 15:32
 */
@Data
public class MemberVO {

    private Long memberId;

    private String memberName;

    private String degree;

    private String subject;

    private String introductionDetail;

    private String memberImg;

    private String introduction;

    public static List<MemberVO> transMemberDOs2VOs(List<MemberDO> memberDOS) {
        List<MemberVO> memberVOS = new ArrayList<MemberVO>();
        memberDOS.stream().forEach(item -> {
            MemberVO memberVO = transMemberDO2VO(item);
            memberVOS.add(memberVO);
        });
        return memberVOS;
    }

    public static MemberVO transMemberDO2VO(MemberDO memberDO) {
        MemberVO memberVO = new MemberVO();
        memberVO.setMemberId(memberDO.getId() >= 0 ? memberDO.getId() : 0L);
        memberVO.setMemberImg(memberDO.getImgUrl());
        memberVO.setMemberName(memberDO.getName());
        memberVO.setDegree(memberDO.getDegree());
        memberVO.setIntroduction(memberDO.getIntroduction());
        memberVO.setIntroductionDetail(memberDO.getIntroductionDetail());
        memberVO.setSubject(memberDO.getSubject());
        return memberVO;
    }

}
